import java.math.BigDecimal;

public class PercentPromotionStrategy implements PromotionStrategy {
    private BigDecimal discount;
    private Fruit fruit;

    public PercentPromotionStrategy(Fruit fruit, BigDecimal discount) {
        this.fruit = fruit;
        this.discount = discount;
    }

    @Override
    public BigDecimal computeDiscountPrice() {
        return this.fruit.getPrice().multiply(this.discount).setScale(2, BigDecimal.ROUND_HALF_UP);
    }
}
